package com.xbongbong.pro.enums.permission.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import lombok.Getter;

import java.util.Objects;

/**
 * @author 吴峰
 * @version v1.0
 * @date 2019/4/23 19:35
 * @since v1.0
 */
@Getter
public enum DeleteProPermissionAliasEnum {

    /**
     * tb_pro_promission对应的alias字段
     */
    CUSTOMER_DELETE(XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode(), "customerDelete", ProPermissionAliasEnum.CUSTOMER_DELETE.getI18nMemo()),

    CONTACT_DEL(XbbRefTypeEnum.CONTACT.getCode(), "contactDelete", ProPermissionAliasEnum.CONTACT_DELETE.getI18nMemo()),

    CONTRACT_DEL(XbbRefTypeEnum.CONTRACT.getCode(), "contractDelete", ProPermissionAliasEnum.CONTRACT_DELETE.getI18nMemo()),

    REFUND_DEL(XbbRefTypeEnum.REFUND.getCode(), "refundDel", ProPermissionAliasEnum.REFUND_DEL.getI18nMemo()),

    OPPORTUNITY_DEL(XbbRefTypeEnum.SALES_OPPORTUNITY.getCode(), "opportunityDelete", ProPermissionAliasEnum.OPPORTUNITY_DELETE.getI18nMemo()),

    COMMUNICATE_PLAN_DEL(XbbRefTypeEnum.COMMUNICATE_PLAN.getCode(), "communicatePlanDelete", ProPermissionAliasEnum.COMMUNICATE_PLAN_DELETE.getI18nMemo()),

    CUSTOMER_COMMUNICATE_DEL(XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode(), "customerCommunicateDelete", ProPermissionAliasEnum.CUSTOMER_COMMUNICATE_DELETE.getI18nMemo()),

    INVENTORY_DEL(XbbRefTypeEnum.INVENTORY.getCode(), "inventoryDelete", ProPermissionAliasEnum.INVENTORY_DELETE.getI18nMemo()),

    TRANSFER_DEL(XbbRefTypeEnum.TRANSFER.getCode(), "transferDelete", ProPermissionAliasEnum.TRANSFER_DELETE.getI18nMemo()),

    WAREHOUSE_DEL(XbbRefTypeEnum.WAREHOUSE.getCode(), "warehouseDelete", ProPermissionAliasEnum.WAREHOUSE_DELETE.getI18nMemo()),

    WORKREPORT_DEL(XbbRefTypeEnum.WORK_REPORT.getCode(), "workReportDelete", ProPermissionAliasEnum.WORK_REPORT_DELETE.getI18nMemo()),

    INVOICE_DEL(XbbRefTypeEnum.INVOICE.getCode(), "invoiceDelete", ProPermissionAliasEnum.INVOICE_DELETE.getI18nMemo()),

    // 进项发票删除权限
    PURCHASE_INVOICE_DEL(XbbRefTypeEnum.PURCHASE_INVOICE.getCode(), "purchaseInvoiceDelete", ProPermissionAliasEnum.PURCHASE_INVOICE_DELETE.getI18nMemo()),

    WORKORDER_DEL(XbbRefTypeEnum.WORK_ORDER.getCode(), "workOrderDelete", ProPermissionAliasEnum.WORK_ORDER_DELETE.getI18nMemo()),

    PAYMENT_DEL(XbbRefTypeEnum.PAYMENT.getCode(), "paymentDelete", ProPermissionAliasEnum.PAYMENT_DELETE.getI18nMemo()),

    PAY_PLAN_DEL(XbbRefTypeEnum.PAY_PLAN.getCode(), "payPlanDelete", ProPermissionAliasEnum.PAY_PLAN_DELETE.getI18nMemo()),

    BOMBILL_DEL(XbbRefTypeEnum.BOM_BILL.getCode(), "bomBillDelete", ProPermissionAliasEnum.BOM_BILL_DELETE.getI18nMemo()),

    PRODUCTIONORDER_DEL(XbbRefTypeEnum.PRODUCTION_ORDER.getCode(), "productionOrderDelete", ProPermissionAliasEnum.PRODUCTION_ORDER_DELETE.getI18nMemo()),

    PRODUCT_DEL(XbbRefTypeEnum.PRODUCT.getCode(), "productDelete", ProPermissionAliasEnum.PRODUCT_DELETE.getI18nMemo()),

    SUPPLIER_DEL(XbbRefTypeEnum.SUPPLIER.getCode(), "supplierDelete", ProPermissionAliasEnum.SUPPLIER_DELETE.getI18nMemo()),

    PURCHASE_DEL(XbbRefTypeEnum.PURCHASE.getCode(), "purchaseDelete", ProPermissionAliasEnum.PURCHASE_DELETE.getI18nMemo()),

    RETURNED_PURCHASE_DEL(XbbRefTypeEnum.RETURNED_PURCHASE.getCode(), "returnPurchaseDelete", ProPermissionAliasEnum.RETURN_PURCHASE_DELETE.getI18nMemo()),

    ASSMBLE_DEL(XbbRefTypeEnum.ASSEMBLE.getCode(), "assembleDelete", ProPermissionAliasEnum.ASSEMBLE_DELETE.getI18nMemo()),

    INSTOCK_DEL(XbbRefTypeEnum.INSTOCK.getCode(), "instockDelete", ProPermissionAliasEnum.INSTOCK_DELETE.getI18nMemo()),

    OTHER_INSTOCK_DEL(XbbRefTypeEnum.OTHER_INSTOCK.getCode(), "instockDelete", ProPermissionAliasEnum.INSTOCK_DELETE.getI18nMemo()),

    PURCHASE_INSTOCK_DELETE(XbbRefTypeEnum.PURCHASE_INSTOCK.getCode(), ProPermissionAliasEnum.PURCHASE_INSTOCK_DELETE.getAlias(), ProPermissionAliasEnum.PURCHASE_INSTOCK_DELETE.getI18nMemo()),

    REFUND_INSTOCK_DELETE(XbbRefTypeEnum.REFUND_INSTOCK.getCode(), ProPermissionAliasEnum.REFUND_INSTOCK_DELETE.getAlias(), ProPermissionAliasEnum.REFUND_INSTOCK_DELETE.getI18nMemo()),

    PRODUCTION_INSTOCK_DELETE(XbbRefTypeEnum.PRODUCTION_INSTOCK.getCode(), ProPermissionAliasEnum.PRODUCTION_INSTOCK_DELETE.getAlias(), ProPermissionAliasEnum.PRODUCTION_INSTOCK_DELETE.getI18nMemo()),

    RETURNED_MATERIEL_INSTOCK_DELETE(XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getCode(), ProPermissionAliasEnum.RETURNED_MATERIEL_INSTOCK_DELETE.getAlias(), ProPermissionAliasEnum.RETURNED_MATERIEL_INSTOCK_DELETE.getI18nMemo()),

    OUTSTOCK_DEL(XbbRefTypeEnum.OUTSTOCK.getCode(), "outstockDelete", ProPermissionAliasEnum.OUTSTOCK_DELETE.getI18nMemo()),

    OTHER_OUTSTOCK_DEL(XbbRefTypeEnum.OTHER_OUTSTOCK.getCode(), "outstockDelete", ProPermissionAliasEnum.OUTSTOCK_DELETE.getI18nMemo()),

    CONTRACT_OUTSTOCK_DELETE(XbbRefTypeEnum.CONTRACT_OUTSTOCK.getCode(), ProPermissionAliasEnum.CONTRACT_OUTSTOCK_DELETE.getAlias(), ProPermissionAliasEnum.CONTRACT_OUTSTOCK_DELETE.getI18nMemo()),

    PRODUCTION_MATERIEL_OUTSTOCK_DELETE(XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getCode(), ProPermissionAliasEnum.PRODUCTION_MATERIEL_OUTSTOCK_DELETE.getAlias(), ProPermissionAliasEnum.PRODUCTION_MATERIEL_OUTSTOCK_DELETE.getI18nMemo()),

    WORK_ORDER_OUTSTOCK_DELETE(XbbRefTypeEnum.WORK_ORDER_OUTSTOCK.getCode(), ProPermissionAliasEnum.WORK_ORDER_OUTSTOCK_DELETE.getAlias(), ProPermissionAliasEnum.WORK_ORDER_OUTSTOCK_DELETE.getI18nMemo()),

    RETURNED_PURCHASE_OUTSTOCK_DELETE(XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getCode(), ProPermissionAliasEnum.RETURNED_PURCHASE_OUTSTOCK_DELETE.getAlias(), ProPermissionAliasEnum.RETURNED_PURCHASE_OUTSTOCK_DELETE.getI18nMemo()),

    WORK_ORDER_DEL(XbbRefTypeEnum.WORK_ORDER.getCode(), "workOrderDelete", ProPermissionAliasEnum.WORK_ORDER_DELETE.getI18nMemo()),

    PAYMENT_SHEET_DEL(XbbRefTypeEnum.PAYMENT_SHEET.getCode(), ProPermissionAliasEnum.PAYMENT_SHEET_DELETE.getAlias(), ProPermissionAliasEnum.PAYMENT_SHEET_DELETE.getI18nMemo()),

    PAY_SHEET_DEL(XbbRefTypeEnum.PAY_SHEET.getCode(), ProPermissionAliasEnum.PAY_SHEET_DELETE.getAlias(), ProPermissionAliasEnum.PAY_SHEET_DELETE.getI18nMemo()),

    QUOTATION_DEL(XbbRefTypeEnum.QUOTATION.getCode(), ProPermissionAliasEnum.QUOTATION_DELETE.getAlias(), ProPermissionAliasEnum.QUOTATION_DELETE.getI18nMemo()),

    SIGN_IN_DELETE(XbbRefTypeEnum.SIGNIN.getCode(),ProPermissionAliasEnum.SIGN_IN_DELETE.getAlias(),ProPermissionAliasEnum.SIGN_IN_DELETE.getMemo()),

    MARKET_ACTIVITY_DELETE(XbbRefTypeEnum.MARKET_ACTIVITY.getCode(),ProPermissionAliasEnum.MARKET_ACTIVITY_DELETE.getAlias(),ProPermissionAliasEnum.MARKET_ACTIVITY_DELETE.getMemo()),
    CLUE_DELETE(XbbRefTypeEnum.CLUE.getCode(),ProPermissionAliasEnum.CLUE_DELETE.getAlias(),ProPermissionAliasEnum.CLUE_DELETE.getMemo()),


    //回款计划删除
    PAYMENT_TASK_DEL(XbbRefTypeEnum.PAYMENT_TASK.getCode(), ProPermissionAliasEnum.PAYMENT_TASK_DELETE.getAlias(), ProPermissionAliasEnum.PAYMENT_DELETE.getMemo()),

    // 对账单删除
    DEL_STATEMENT(XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode(), ProPermissionAliasEnum.DEL_STATEMENT.getAlias(), ProPermissionAliasEnum.DEL_STATEMENT.getAlias()),

    /**
     * 经销商
     */
    DISTRIBUTOR_MANAGEMENT(XbbRefTypeEnum.DISTRIBUTOR_MANAGEMENT.getCode(), ProPermissionAliasEnum.DISTRIBUTOR_DELETE.getAlias(), ProPermissionAliasEnum.DISTRIBUTOR_DELETE.getI18nMemo()),
    DISTRIBUTOR_CONTACT(XbbRefTypeEnum.DISTRIBUTOR_CONTACT.getCode(), ProPermissionAliasEnum.DISTRIBUTOR_CONTACT_DELETE.getAlias(), ProPermissionAliasEnum.DISTRIBUTOR_CONTACT_DELETE.getI18nMemo()),
    DISTRIBUTOR_COMMUNICATE(XbbRefTypeEnum.DISTRIBUTOR_COMMUNICATE.getCode(), ProPermissionAliasEnum.DISTRIBUTOR_COMMUNICATE_DELETE.getAlias(), ProPermissionAliasEnum.DISTRIBUTOR_COMMUNICATE_DELETE.getI18nMemo()),
    ORDER(XbbRefTypeEnum.ORDER.getCode(), ProPermissionAliasEnum.ORDER_DELETE.getAlias(), ProPermissionAliasEnum.ORDER_DELETE.getI18nMemo()),
    RETURN(XbbRefTypeEnum.RETURN.getCode(), ProPermissionAliasEnum.RETURN_DELETE.getAlias(), ProPermissionAliasEnum.RETURN_DELETE.getI18nMemo()),
    // 竞争对手
    COMPETITOR_DELETE(XbbRefTypeEnum.COMPETITOR.getCode(),ProPermissionAliasEnum.COMPETITOR_DELETE.getAlias(),ProPermissionAliasEnum.COMPETITOR_DELETE.getI18nMemo()),
    WORK_ORDER_V2_DELETE(XbbRefTypeEnum.WORK_ORDER_V2.getCode(),ProPermissionAliasEnum.WORK_ORDER_V2_DELETE.getAlias(),ProPermissionAliasEnum.WORK_ORDER_V2_DELETE.getI18nMemo()),
    SERVICE_PROJECT_DELETE(XbbRefTypeEnum.SERVICE_PROJECT.getCode(),ProPermissionAliasEnum.SERVICE_PROJECT_DELETE.getAlias(),ProPermissionAliasEnum.SERVICE_PROJECT_DELETE.getI18nMemo()),

    ;

    private Integer code;

    private String alias;

    private String memo;

    DeleteProPermissionAliasEnum(Integer code, String alias, String memo) {
        this.code = code;
        this.alias = alias;
        this.memo = memo;
    }

    public static DeleteProPermissionAliasEnum getByCode(Integer businessType) {
        for (DeleteProPermissionAliasEnum item: values()) {
            if (Objects.equals(item.getCode(), businessType)) {
                return item;
            }
        }
        return null;
    }

    public String getMemo() {
        return I18nMessageUtil.getMessage(memo);
    }
}
